﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="DataViz.aspx.vb" Inherits="_3dBuzz.DataViz" %>
<%@ Register assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI.DataVisualization.Charting" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <p>
    <br />
    <asp:Label ID="Label1" runat="server" Text="Chart of Likes by Video Title"></asp:Label>
</p>
<p>
    <asp:Chart ID="Chart1" runat="server" DataSourceID="SqlDataSource1">
        <series>
            <asp:Series Name="Series1" XValueMember="Title" YValueMembers="NumLikes">
            </asp:Series>
        </series>
        <chartareas>
            <asp:ChartArea Name="ChartArea1">
            </asp:ChartArea>
        </chartareas>
    </asp:Chart>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:3dBuzzDatabase %>" 
        ProviderName="<%$ ConnectionStrings:3dBuzzDatabase.ProviderName %>" SelectCommand="SELECT Count(Likes.[VideoId_fk]) AS NumLikes, Video.[Title], Likes.[VideoId_fk]
FROM Video INNER JOIN Likes ON Video.[VideoId] = Likes.[VideoId_fk]
GROUP BY Likes.[VideoId_fk], Video.[Title], Likes.[VideoId_fk];
"></asp:SqlDataSource>
</p>
<p>
    <asp:Label ID="Label2" runat="server" Text="Ratings Chart"></asp:Label>
</p>
    <p>
        <asp:Chart ID="Chart2" runat="server" DataSourceID="SqlDataSource2">
            <series>
                <asp:Series ChartType="Bubble" Name="Series1" XValueMember="Title" 
                    YValueMembers="AverageRating, RatingCount" YValuesPerPoint="2">
                </asp:Series>
            </series>
            <chartareas>
                <asp:ChartArea Name="ChartArea1">
                </asp:ChartArea>
            </chartareas>
        </asp:Chart>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:3dBuzzDatabase %>" 
            ProviderName="<%$ ConnectionStrings:3dBuzzDatabase.ProviderName %>" SelectCommand="SELECT UserRating.[VideoId_fk], Video.[Title], Video.[Showreel], AVG(UserRating.[Rating]) AS AverageRating, COUNT (UserRating.[Rating]) as RatingCount
FROM Video INNER JOIN UserRating ON Video.[VideoId] = UserRating.[VideoId_fk]
GROUP By UserRating.[VideoId_fk], Video.[Title], Video.[Showreel];"></asp:SqlDataSource>
</p>
    <p>
</p>
    <p>
</p>
    <p>
</p>
<p>
</p>
</asp:Content>
